﻿function SPRAOpenMyTaskEnable() {
    var items = SP.ListOperation.Selection.getSelectedItems();
    var itemCount = CountDictionary(items);

    return (itemCount == 1);
}

function SPRAOpenMyTaskDialogCallback(dialogResult, returnValue) {
}


function SPRAOpenMyTask(SiteUrl, ItemId, ListId, Source) {
    var items = SP.ListOperation.Selection.getSelectedItems();
    var selectedItems = '';
    var i;
    for (i in items) {
        selectedItems += '|' + items[i].id;
    }
    var options = {
        url: SiteUrl + '/_layouts/SPRA/OpenMyTask.aspx?ItemId=' + ItemId + '&SiteId=' + SiteUrl + '&ListId=' + ListId + '&SelectedItems=' + selectedItems + '&Source=' + Source,
        allowMaximize: true,
        showClose: true,
        dialogReturnValueCallback: SPRAOpenMyTaskDialogCallback
    };

    SP.UI.ModalDialog.showModalDialog(options);
}